/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef __HALFSPACE_H__
#define __HALFSPACE_H__

#include "Plane.h"
#include "Intersection.h"

namespace liba
{
namespace math
{

// A plane describes a half space, where the normal points inside the space.
// That half space defines the way containment is seen. The half space is
// topologically closed (i.e. the plane itself is contained in the space).
class HalfSpace
{
public:
	HalfSpace()
	{}

	HalfSpace( const Plane<float> & plane );

	Intersect::Type intersects( const Sphere & sphere )const;
	Intersect::Type intersects( const Box & box )const;
	bool containts( const Vector3<float> & point )const;

	void transform( const Matrix4<float> & transform )
	{
		plane.transform( transform );
	}

	const Plane<float> get_plane()const
	{
		return plane;
	}

private:
	Plane<float> plane;
};

} // namespace math
} // namespace liba
using namespace liba;

#endif //__HALFSPACE_H__